package dayOfyear;

import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int year = sc.nextInt();
        int month = sc.nextInt();
        int day = sc.nextInt();

        int days = 0;

        boolean isleap = (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);

        switch (month - 1) {
            case 12:
                days += 31;
            case 11:
                days += 30;
            case 10:
                days += 31;
            case 9:
                days += 30;
            case 8:
                days += 31;
            case 7:
                days += 31;
            case 6:
                days += 30;
            case 5:
                days += 31;
            case 4:
                days += 30;
            case 3:
                days += 31;
            case 2:
                day += isleap ? 29 : 28;
            case 1:
                days += 31;
        }
        days += day;
        System.out.println(days);
    }
}
